<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/admin/static/css/font.css">
    <link rel="stylesheet" href="/admin/static/css/xadmin.css">
    <script type="text/javascript" src="/admin/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/admin/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/admin/static/js/xadmin.js"></script>

    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
    <div class="x-body">
        <form class="layui-form" action="/admin/paper/add" method="POST" enctype="multipart/form-data">
            <div class="layui-form-item">
                <label for="L_title" class="layui-form-label">
                    <span class="x-red">*</span>标题
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_title" name="title" required="" lay-verify="title" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_year" class="layui-form-label">
                    <span class="x-red">*</span>年度
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_year" name="year" required="" lay-verify="number|year" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_author" class="layui-form-label">
                    <span class="x-red">*</span>作者
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_author" name="author" required="" lay-verify="author" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_journal" class="layui-form-label">
                    <span class="x-red">*</span>期刊
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_journal" name="journal" required="" lay-verify="journal"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_vnumber" class="layui-form-label">
                    <span class="x-red">*</span>卷期号
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_vnumber" name="vnumber" required="" lay-verify="vnumber" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_type" class="layui-form-label">
                    <span class="x-red">*</span>收录类型
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_type" name="type" required="" lay-verify="type" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_impact" class="layui-form-label">
                    <span class="x-red">*</span>影响因子
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_impact" name="impact" required="" lay-verify="impact" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_partition" class="layui-form-label">
                    <span class="x-red">*</span>分区
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_partition" name="partition" required="" lay-verify="partition"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="link" class="layui-form-label">
                    <span class="x-red">*</span>文章链接
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="link" name="link" required="" lay-verify="link"
                           autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">
                </label>
                <button class="layui-btn" lay-filter="modify" lay-submit="">
                    增加
                </button>
            </div>
        </form>
    </div>
    <script>
        $('#file-btn').on('click', function() {
            $('#file-input').click();
        });
        $('#file-input').on('change', function() {
            $('#show').text(this.files[0].name)
        });
        layui.use(['form', 'layer'], function () {
            $ = layui.jquery;
            var form = layui.form
                , layer = layui.layer;

            //自定义验证规则
            form.verify({
                title: function (value) {
                    if (value.length < 1) {
                        return '标题不能为空';
                    } else if (value.length > 50) {
                        return '标题不能大于50个字符';
                    }
                },
                year: function (value) {
                    if (value.length < 1) {
                        return '年度不能为空';
                    } else if (value.length > 10) {
                        return '年度不能大于10个字符';
                    }
                },
                author: function (value) {
                    if (value.length < 1) {
                        return '作者不能为空';
                    } else if (value.length > 50) {
                        return '作者不能大于50个字符';
                    }
                },
                journal: function (value) {
                    if (value.length < 1) {
                        return '期刊不能为空';
                    } else if (value.length > 50) {
                        return '期刊不能大于50个字符';
                    }
                },
                vnumber: function (value) {
                    if (value.length < 1) {
                        return '卷期号不能为空';
                    } else if (value.length > 50) {
                        return '卷期号不能大于50个字符';
                    }
                },
                type: function (value) {
                    if (value.length < 1) {
                        return '收录类型不能为空';
                    } else if (value.length > 50) {
                        return '收录类型不能大于50个字符';
                    }
                },
                impact: function (value) {
                    if (value.length < 1) {
                        return '影响因子不能为空';
                    } else if (value.length > 50) {
                        return '影响因子不能大于50个字符';
                    }
                },
                partition: function (value) {
                    if (value.length < 1) {
                        return '分区不能为空';
                    } else if (value.length > 50) {
                        return '分区不能大于50个字符';
                    }
                }
            });
        });
    </script>
</body>

</html>